{% set pypi_name = 'python-designateclient' %}
{% set upstream_version = upstream_version('4.1.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        OpenStack DNS as a Service - Client
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('jsonschema') }}
BuildRequires:  {{ py3('keystoneauth1') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('oslo.serialization') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('stestr') }}
BuildArch:      noarch

%description
OpenStack DNS as a Service - Client

%package -n python3-designateclient
Summary:        OpenStack DNS as a Service - Client
Requires:       {{ py3('cliff') }}
Requires:       {{ py3('debtcollector') }}
Requires:       {{ py3('jsonschema') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}

%description -n python3-designateclient
OpenStack DNS as a Service - Client

This package contains the Python 3.x module.

%package -n {{ py2name() }}-doc
Summary:        Documentation for the OpenStack DNS as a Service - Client
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n {{ py2name() }}-doc
Documentation for the OpenStack DNS as a Service - Client.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%py3_build

# generate docs
PYTHONPATH=. PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%py3_install

%check
python3 -m stestr.cli run

%files -n python3-designateclient
%license LICENSE
%doc README.rst
%{python3_sitelib}/designateclient
%{python3_sitelib}/python_designateclient-%{version}-*.egg-info

%files -n {{ py2name() }}-doc
%license LICENSE
%doc doc/build/html ChangeLog

%changelog
